package com.rentong.wx.cust.controller;

import com.rentong.common.R;
import com.rentong.wx.cust.dto.CustUserInfoDto;
import com.rentong.wx.cust.service.CustUserServiceService;
import com.rentong.wx.utils.WxApiUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zhangle
 * @email 459343178@qq.com
 * @date 2024-12-24 14:42:31
 */
@RestController
public class CustUserServiceController {

    @Autowired
    private CustUserServiceService custUserServiceService;


    //108、师傅添加或修改服务介绍或相关证书
    @PostMapping("/custUser/updateCustUserInfo")
    public R updateCustUserInfo(HttpServletRequest request, @RequestBody CustUserInfoDto custUserInfoDto) throws Exception {
        return custUserServiceService.updateCustUserInfo(WxApiUtil.getCurrentCustId(request), custUserInfoDto);
    }


    //300、设置师傅状态
    @PostMapping("/custUser/updateCustUserStatus")
    public R updateCustUserStatus(HttpServletRequest request) throws Exception {
        custUserServiceService.updateCustUserStatus(WxApiUtil.getCurrentCustId(request));
        return R.success("操作成功");
    }

    //301、师傅端个人中心（废弃了）
    @GetMapping("/custUser/getCustUserInfo")
    public R getCustUserInfo(HttpServletRequest request) throws Exception {
        return R.success(custUserServiceService.getCustUserInfo(WxApiUtil.getCurrentCustId(request)));
    }

}
